<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>假日活动订单列表</title>
<meta name="viewport"
	content="width=device-width,initial-scale=1,maximum-scale=1.0" />
<#include "/view/admin/head.html"/>
<link rel="stylesheet" type="text/css"
	href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" type="text/css"
	href="${base}/jstool/bootstrap-switch/css/bootstrap3/bootstrap-switch.min.css" />
<link rel="stylesheet" type="text/css"
	href="${base}//jstool/bootstrap-fileinput/css/fileinput.min.css" />
<script type="text/javascript"
	src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript"
	src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript"
	src="${base}/jstool/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<script type="text/javascript"
	src="${base}/jstool/bootstrap-fileinput/js/fileinput.min.js"></script>
<script type="text/javascript"
	src="${base}/jstool/bootstrap-fileinput/js/locals/zh.js"></script>
<link rel="stylesheet" type="text/css"
	href="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/css/bootstrap-select.css.map" />
<link rel="stylesheet" type="text/css"
	href="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/css/bootstrap-select.min.css"/>
         <script type="
	text/javascript" src="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/js/bootstrap-select.min.js">
</script>
<!-- <script type="text/javascript"
	src="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/js/bootstrap-select.js.map"></script> -->
<script type="text/javascript"
	src="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/js/i18n/defaults-zh_CN.min.js"></script> 

<style type="text/css">
.table-class {
	width: 90%;
	text-align: center;
	border: 1px solid #afd9ee;
	margin: 0 auto;
	margin-top: 50px;
}

.list-path {
	height: 50px;
	line-height: 50px;
	background-color: #9acfea;
}

table th {
	text-align: center;
	WORD-WRAP: break-word;
	width: 100px;
}

table thead tr {
	background-color: #9acfea;
}

.table-query {
	/*height: 40px;*/
	/*width:80px;*/
	/*text-align: center;*/
	white-space: nowrap;
	/*position: relative;*/
	float: left;
	display: inherit;
	/*display: inline;*/
}

.label-head {
	height: 60px;
	width: 100%;
}

.bs-example .input-group {
	width: 300px;
	float: left;
	margin-top: 20px;
}

.bank-label {
	width: 25px;
	float: left;
}

.label-hidden {
	display: none;
}

.panel-body {
	padding-top: 0px;
}
/* .input-group{
            margin-top:20px;
        }*/
</style>
<script type="text/javascript">
	function query(dm) {
		var href = "${base}/activity/list?";

		href += 'telephone=' + $('#telephone').val()+"&";
		href += 'activityNum=' + $('#activityNum').val()+"&";
		href += 'beginTime=' + $('#beginTime').val()+"&";
		href += 'endTime=' + $('#endTime').val()+"&";
		href += 'status=' + $('#status').val()+"&";
		href += 'festivalActId=' + $('#festivalActId').val()+"&";
		location.href = href;
	}
</script>
</head>
<body>

	<#include "/view/admin/listnav.html"/>


	<div class="table-class">
		<div class="panel panel-default" style="margin: 10px 50px 10px;">
			<div class="panel-body">
				<form class="bs-example bs-example-form" role="form">

					<div class="input-group">
						<span class="input-group-addon">手机号码</span> <input type="text"
							id="telephone" value="${telephone!}" class="form-control"
							placeholder="请输入手机号码">
					</div>
					<span class="bank-label">&nbsp;</span>
					<div class="input-group">
						<span class="input-group-addon">下单时间大于</span>
						<div class="input-append date begin_datetime" data-date="">
						 	<input size="16" name="beginTime" type="text" class="form-control"
									value="${beginTime!?html}" id="beginTime"
									readonly> <span class="add-on"><i
									class="icon-remove"></i></span> <span class="add-on"><i
									class="icon-calendar"></i></span>
									</div>
					</div>
					<span class="bank-label">&nbsp;</span>
					<div class="input-group">
						<span class="input-group-addon">下单时间小于</span>
						
						<div class="input-append date end_datetime" data-date="">
						 <input size="16" name="endTime" id="endTime" type="text"  class="form-control"
									value="${endTime!?html}"
									readonly> <span class="add-on"><i
									class="icon-remove"></i></span> <span class="add-on"><i
									class="icon-calendar"></i></span>
									</div>
					</div>

					<span class="bank-label">&nbsp;</span>

					<div class="input-group">
						<span class="input-group-addon">订单编号</span> <input type="text"
							id="activityNum" value="${activityNum!	}" class="form-control" placeholder="请输入订单编号">
					</div>
					<span class="bank-label">&nbsp;</span>
					 <div class="input-group">
                <span class="input-group-addon">订单状态</span>
                <select id="status" name="status"
                        class="form-control"
                >
                    <option value="-1">请选择</option>
                            <option value="0"  <#if status?? &&  status=="0">selected="selected"</#if> >待支付</option>
                            <option value="4"  <#if status?? && status=="4">selected="selected"</#if> >未使用</option>
                             <option value="5"  <#if status?? && status=="5">selected="selected"</#if> >已使用</option>
                             <option value="17"  <#if status?? && status=="5">selected="selected"</#if> >订单已取消</option>

                </select>
                </div>
                
                <span class="bank-label">&nbsp;</span>
					 <div class="input-group">
                <span class="input-group-addon">活动名称</span>
                <select id="festivalActId" name="festivalActId"
                        class="form-control"
                >
                    <option value="">请选择</option>
                       	<#list fests as c>
                       		  >${c.festName!}</option>
                       	</#list>
                       	
                       	<#list fests as c>
                                        <option value="${c.festivalActId!}"
                                        <#if c.festivalActId??&&festivalActId??&&c.festivalActId == festivalActId >
                                            selected="selected"
                                        </#if>
                                              >${c.festName!}</option>
                                    </#list>

                </select>

            </div>
			
					<div class="input-group" style="text-align: right;">
						<a class="btn btn-info" href="javascript:query(this)"><span
							class="glyphicon glyphicon-search"></span> 查找</a>
					</div>
				</form>
			</div>
		</div>

		<#include "/view/admin/opermsg.html"/>
		<table class="table table-hover table-bordered">
			<thead>
			<#--	 <tr>
		    		<td colspan="5" >已支付订单(笔)</td>
		    		<td colspan="6">未支付订单(笔)</td>
		    </tr> 
		       <tr style="background: white;">
		    		<td colspan="5" style="color:red ">${pay2!}</td>
		    		<td colspan="6" style="color:red ">${pay1!}</td>
		    </tr>-->
				<tr>
					<th>序号</th>
					<th>订单号</th>
					<th>购买用户</th>
					<th>订单金额(元)</th>
					<th>订单状态</th>
					<th>下单时间</th>
					<th>购买数量</th>
					<th>活动名称</th>
					<!-- <th>活动主题</th>
					<th>随机码</th> -->
					<th style="width: 150px">操作</th>
				</tr>
			</thead>
			<tbody>
				<#list pagination.list as c>
				<tr>

					<td>${(pagination.pageNo-1)*pagination.pageSize+1+c_index}</td>
					<td>${c.activityNum !}</td>
						<td>${c.nickname !}</td>
					<td>${c.totalAmount !}</td>
					<td>
						<#if c.status ??>
							<#if c.status==0>
									待支付
							</#if>
							<#if c.status==4>
									未使用
							</#if>
							<#if c.status==5	>
									已使用
							</#if>
							
						
						<#else>
						--
						</#if>
						
					</td>
					<td><#if (c.createtime)??>${c.createtime?string('yyyy-MM-dd HH:mm')}</#if></td>
					<td>${c.nun !}</td>
					<td>${c.festName!}</td>
					<!-- <td>${c.festTheme !}</td>
					<th>${c.randStr !}</th> -->
					<td>
						<@shiro.hasPermission name="actrefund">
						<#if c.status==4>
							<a href="javascript:refund('${c.activityNum!}')" class="btn btn-primary">退款</a>
						</#if>
						</@shiro.hasPermission>
					<@shiro.hasPermission name="8.2.1"> 
						 <a
						href=" ${base}/activity/detail?activityId=${c.activityId!}"
						class="btn btn-primary">详情</a>
				    </@shiro.hasPermission>		
					</td>
				</tr>


				</#list> <#if 0==pagination.totalCount>
				<tr>
					<td colspan="7" style="color: red">没有相关数据</td>
				</tr>
				</#if>
				<tr>
					<td colspan="26+1">
						<div style="text-align: left; margin-left: 50px;">


							<!-- <a href="javascript:a();" class="btn btn-primary">json</a> -->
						</div>
					</td>
				</tr>



				<input type="hidden" name="pageNo" value="${pagination.pageNo}" />


			</tbody>
		</table>
		<#include "/view/admin/pagination.html"/>
	</div>


</body>
</html>

<script>
	function setPage(pageNo, pageSize) {
		var href = "${base}/activity/list?";
        href += 'telephone=' + $('#telephone').val()+"&";
        href += 'activityNum=' + $('#activityNum').val()+"&";
		href += 'festivalActId=' + $('#festivalActId').val()+"&";
        href += 'beginTime=' + $('#beginTime').val()+"&";
        href += 'endTime=' + $('#endTime').val()+"&";
        href += 'status=' + $('#status').val()+"&";
		href += "&pageNo=" + pageNo;
		href += "&pageSize=" + pageSize;
		location.href = href;
	}
</script>

<script>
	function doDelete(id) {
		var pageNo = $("input[name='pageNo']").val();
		if (window.confirm("你确定删除吗?")) {
			window.location = "${base}/activity/deleteAct?activityId=" + id
					+ "&pageNo=" + pageNo;
		}
	}
</script>

<script type="text/javascript">
	$(".begin_datetime")
			.datetimepicker(
					{
						language : 'zh-CN',//显示中文
						format : "yyyy-mm-dd hh:ii",
						autoclose : true,
						todayBtn : true,
						startDate : "<#if (beginTime)??></#if>",
						minuteStep : 10
					});
</script>

<script type="text/javascript">
	$(".end_datetime")
			.datetimepicker(
					{
						language : 'zh-CN',//显示中文
						format : "yyyy-mm-dd hh:ii",
						autoclose : true,
						todayBtn : true,
						startDate : "<#if (endTime)??></#if>",
						minuteStep : 10
					});

	function refund(orderno){
        if (window.confirm("你确定要退款吗，退款后的金额直接退款到用户手中。")) {
            window.location="${base}/activity/refund.do?orderno="+orderno;
        }
	}
</script>
